package com.wuyb.controller;

import com.wuyb.pojo.entity.BaseResponse;
import com.wuyb.pojo.param.ImgBase64Param;
import com.wuyb.service.MeetingScreenshotService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

/**
 * 会议截屏
 *
 * @Author: wyb
 * @Date: 2024/01/08/19:01
 * @Description:
 */
@Api(tags = "会议截屏")
@Slf4j
@RestController
@RequestMapping("/meetingScreenshot")
public class MeetingScreenShotController {

    @Resource
    private MeetingScreenshotService meetingScreenshotService;


    @ApiOperation("接收base64,保存截屏图像")
    @PostMapping("/{mid}")
    public BaseResponse<?> setScreenshotWithBase64(@RequestBody @Validated ImgBase64Param param, @PathVariable String mid) {
        log.info(String.format("Post:/meetingScreenshot/%s 接收base64,保存截屏图像 %s", mid, param));
        return meetingScreenshotService.setScreenshotWithBase64(mid, param);
    }
    @ApiOperation("根据会议id输出该用户的截屏路径")
    @GetMapping("/{mid}/path")
    public BaseResponse<?> selectPath( @PathVariable String mid) {
        log.info(String.format("Get:/meetingScreenshot/%s 接收base64,保存截屏图像", mid));
        return meetingScreenshotService.selectPath(mid);
    }

    @ApiOperation("输出该用户所有会议截屏")
    @GetMapping()
    public BaseResponse<?> selectAll() {
        log.info("Get:/meetingScreenshot 输出该用户所有会议截屏");
        return meetingScreenshotService.selectAll();
    }

    @ApiOperation("根据id删除")
    @DeleteMapping("/{id}")
    public BaseResponse<?> deleteById(@PathVariable String id) {
        log.info(String.format("Delete:/meetingScreenshot/%s 根据id删除", id));
        return meetingScreenshotService.deleteById(id);
    }
}
